/*
 * Created on 2005-10-9
 *
 */
package com.hd123.rumba.user;

import java.util.List;

import net.sf.hibernate.HibernateException;

import com.hd123.rumba.exception.BusinessException;
import com.hd123.rumba.runtime.IManager;
import com.hd123.rumba.util.AccessMode;

/**
 * @author caili
 */
public interface IPermissionMgr extends IManager {
  public IPermission createPermission(String code, String name) throws HibernateException,
      BusinessException;

  public void savePermission(IPermission perm) throws HibernateException, BusinessException;

  public void removePermission(IPermission perm) throws HibernateException, BusinessException;

  public IPermission getPermission(String uuid) throws HibernateException, BusinessException;

  public IPermission getPermissionByCode(String code) throws HibernateException, BusinessException;

  public List createUserPermissionsList(IUser user) throws HibernateException, BusinessException;

  public AccessMode createFieldsAccessMode(IUser user, Class cls) throws IllegalAccessException,
      BusinessException;

  public List createAllPermissionsList() throws HibernateException, BusinessException;

  /**
   * 取得指定构件包功能视图的所有权限。
   * 
   * @param cartFuncViewUuid
   *          指定构件包功能视图的uuid。
   * @return
   * @throws BusinessException
   * @throws HibernateException
   */
  public List<IPermission> getPermissionsByCartFuncView(String cartFuncViewUuid)
      throws BusinessException, HibernateException;

  public void initPermissionsT(Class cls) throws Exception;

  /**
   * 添加指定类中包含的权限到角色中。
   * 
   * @param role
   *          指定被添加的角色。
   * @param cls
   *          指定包含权限的类。
   * @throws BusinessException
   * @throws HibernateException
   */
  public void addPermissionsForRoleT(IRole role, Class cls) throws BusinessException,
      HibernateException;
}
